<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title></title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/global/reset.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/global/public-header.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/global/public-footer.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/static/module/platform.css">
    <script src="${pageContext.request.contextPath}/static/global/jquery-1.8.0.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/global/common-use.js"></script>
</head>
<body>

<div class="page-container">
<!-- 头部 -->
<c:import url="commons/header.jsp"/>
<!-- //头部 -->
<!-- 首页 -->
<div class="page-index page-1020">
<div class="tips-box">
    TIPS:网贷有风险，投资需谨慎，P2P900对国内前100强网贷平台作了深入调研，得出各平台投资指数，指数星级越高，表示投资越安全！
</div>

<div class="info-box">
    <p class="info-img fl">
        <a href="#"><img src="${pageContext.request.contextPath}/static/upload/info-img.jpg" width="120" height="120"></a>
        <a href="${platform.site}" class="go-web">去官方网站</a>
    </p>
    <div class="info-right fl">
        <h2>${platform.name}</h2>
        <dl class="info-1">
            <dt>基本信息</dt>
            <dd><span>基本信息：</span>${platform.name}</dd>
            <dd><span>网站网站：</span><a href="#">${platform.site}</a></dd>
            <dd><span>投资指数：</span><i class="star-score star-score-${platform.star}"></i></dd>
            <dd><span>年化收益：</span>${platform.annualEarnings}</dd>
            <dd><span>所在地区：</span></dd>
            <dd><span>上线时间：</span>${platform.onlineDate}</dd>
        </dl>
        <dl class="info-2">
            <dt>公司信息</dt>
            <dd><span class="info-top">公司名称：</span><em>${platform.company}</em></dd>
            <dd><span>公司法人：</span>${platform.legalMan}</dd>
            <dd><span>注册日期：</span>${platform.registerDate}</dd>
            <dd><span>注册资金：</span>${platform.registeredCapital}万</dd>
            <dd><span>ICP备案：</span>${platform.icpCode}</dd>

        </dl>
        <dl class="info-3">
            <dt>联系方式</dt>
            <dd><span class="info-top">公司地址：</span><em>${platform.company}</em></dd>
            <dd><span>联系电话：</span>${platform.telephone}</dd>
            <dd><span>400电话：</span>${platform.phone400}</dd>
            <dd><span>公司传真：</span>${platform.faxNumber}</dd>
            <dd><span>服务邮箱：</span>${platform.email}</dd>

        </dl>
    </div>
</div>

<div class="info-list">
<div class="clearfix business-info-tab-hd">
    <ul class="clearfix">
        <li class="current">产品</li>
        <li>简介</li>
        <li>管理费</li>
    </ul>
</div>
<div class="business-info-tab-bd">
    <div id="products" class="business-info-tab-item" style="display:block"></div>
    <div class="business-info-tab-item" >222</div>
    <div class="business-info-tab-item" >333</div>
    <input id="productsPage" type="hidden" value="0">
</div>

</div>

<script>
    $(".info-list").tabSwitch(
            {
                tabTit : ".business-info-tab-hd li",
                tabCon : ".business-info-tab-bd .business-info-tab-item",
                tabTitClass : "current"
            }
    );
</script>
<c:import url="commons/friend-links.jsp"/>
</div>
<!-- //首页 -->

<!-- 底部 -->
<c:import url="commons/footer.jsp"/>
<!-- //底部 -->
</div>

<div class="top-img pos_bun5"></div>

</body>
</html>



<script>
    $(".mod-hot-box").tabSwitch(
            {
                tabTit : ".business-info-tab-hd li",
                tabCon : ".business-info-tab-bd .business-info-tab-item",
                tabTitClass : "current"
            }
    );

    $(".mod-new-box").tabSwitch(
            {
                tabTit : ".business-info-tab-hd li",
                tabCon : ".business-info-tab-bd .business-info-tab-item",
                tabTitClass : "current"
            }
    );

    function showProducts(page){
        $.getJSON("/product/listInPlatform", {"platformId" : ${platform.id},"page" : page}, function(result){
            var productsHtml = '';
            if (result.totalElements > 0) {
                productsHtml += "<table width='100%' class='list-table'><tr>" +
                        "<th>产品名称</th>" +
                        "<th>收益率</th>" +
                        "<th>投资期限</th>" +
                        "<th>金额</th>" +
                        "<th>产品类型</th>" +
                        "<th>还款方式</th>" +
                        "<th>进度</th>" +
                        "<th>平台</th>" +
                        "<th>&nbsp;</th></tr>";
                $.each(result.content, function(index, element) {
                    productsHtml += "<tr>" +
                            "<td><em class='font-blue'>"+element.name+"</em></td>" +
                            "<td>"+element.yieldRate+"%</td>" +
                            "<td>"+element.timeLimit+"个月</td>" +
                            "<td>"+element.amount+"</td>" +
                            "<td>"+element.classify+"</td>" +
                            "<td>"+element.repaymentType+"</td>" +
//                            "<td>"+element.progress+"</td>" +
                            "<td>"+element.progress+"%</td>" +
                            "<td><img src='${platform.logo}' width='120' height='45'></td>" +
                            "<td><a href='"+element.originUrl+"' class='tab-btn'>投资</a></td>" +
                            "</tr>";
                });
                productsHtml += "</table>";
                $("#products").html(productsHtml);
                //@todo 分页
//                productsDiv.append(showPager());
            } else {
                $("#products").html("没有商品展示！");
            }
        });
    }

    function showPager(pageNumber, pageSize, totalPages){
        if(totalPages == 0){
         return "";
        }
        if(totalPages == 1){
            return "<a href='javascript:void(0);' class='cur'>1</a>";
        }
        //@todo
        var pageHtml = "<div class='page'>" +
        "<a href='javascript:void(0);' onclick=''>首页</a>" +
        "<a href='javascript:void(0);'>上一页</a>" +
        "<a href='javascript:void(0);' class='cur'>1</a>" +
        "<a href='javascript:void(0);'>2</a>" +
        "<a href='javascript:void(0);'>3</a>" +
        "..." +
        "<a href='javascript:void(0);'>4</a>" +
        "<a href='javascript:void(0);'>下一页</a>" +
        "<a href='javascript:void(0);'>尾页</a>" +
        "</div>";
        return pageHtml;
    }
    (function () {
        $backToTop = function () {
            var st = jQuery(document).scrollTop(),
                    winh = jQuery(window).height();
            var favLink1 = $(".info-list");
            var favLinkY = favLink1.offset().top;
            (st > favLinkY) ? $(".business-info-tab-hd").addClass("fix-ed") : $(".business-info-tab-hd").removeClass("fix-ed");
        };
        jQuery(window).bind("scroll", $backToTop);
        $backToTop();
        showProducts(0);
    })();
</script>
